#!/usr/bin/python3
# -*- coding:UTF-8 -*-
"""Module DocString"""

__author__ = 'Wang Zhe'

import pymysql

def main():
    """Func DocString"""
    conn = pymysql.connect(user='root', password='123456', database='test')
    cursor = conn.cursor()
    cursor.execute('drop table if exists user ')
    cursor.execute('create table user (id varchar(20) primary key, name varchar(20))')
    cursor.execute('insert into user (id, name) values (%s, %s)', ['1', 'wangzhe'])
    print(cursor.rowcount)
    conn.commit()
    cursor.close()

    cursor = conn.cursor()
    cursor.execute('select * from user where id = %s', ('1',))
    print(cursor.fetchall())
    cursor.close()
    conn.close()

if __name__ == '__main__':
    main()
